package com.huarui.permission.dao;

import java.util.List;
import java.util.Map;

import org.ewaf.framework.model.IDataObject;

import com.huarui.permission.dataobject.Permission;
import com.huarui.permission.dataobject.Role;
import com.huarui.permission.dataobject.RoleTemplate;

public interface PermissionDao{

	/**
	 * 查询某个用户的角色列表
	 * @param userId
	 * @return
	 */
	List<Integer> getRoleIds(Integer userId);

	/**
	 * 判断某组角色对某个permissionId是否有权限
	 * @param permissionId
	 * @param roleIds
	 * @return
	 */
	int hasPermission(Integer permissionId, List<Integer> roleIds);

	
	List<RoleTemplate> getRoleTemplates(Integer targetType,Integer targetValue);
	
	
	List<Integer>  getDefaultPermissionIds(Integer roleTemplateId);
	
	
	Role createRole(RoleTemplate roleTemplate , Integer companyId);
	
	List<Role> createRoles(List<RoleTemplate> roleTemplates , Integer companyId);
	
	void  perparePermissions(RoleTemplate roleTemplate, Role role);
	
	void  perparePermissions(Role role,Integer donateType);
	
	 boolean deleteAllRolesAndPermission(final Integer companyId);

//	Action findAction(String action, String method);

	public List<Integer> getPermissionIds(Integer employeeId);
	
	public List<Role> grantCompanyAllRole(Integer companyId);
	
	void addCompanyAdminRole(Integer employeeId,Integer companyId);
	
	public List<Permission> getAllPermissions();
	
	@SuppressWarnings("unchecked")
	public int deleteByCondition(Map map);
	
	public void create(IDataObject data);
	
	public Permission getById(Map<String, Object> map);
	
	public boolean update(IDataObject data);
	
	@SuppressWarnings("unchecked")
	public List<Permission> getPermissionListByCondition(Map map);
}
